import { ref } from 'vue'
import { defineStore } from 'pinia'

export const useUserStore = defineStore(
  'user',
  () => {
    const deviceId = ref(null)
    const username = ref('')
    const userTasks = ref([])
    // const user
    const setDeviceId = (id) => {
      deviceId.value = id
    }
    const setUsername = (name) => {
      username.value = name
    }

    const setUserTasks = (tasks) => {
      userTasks.value = tasks
    }
    return {
      deviceId,
      setDeviceId,
      username,
      setUsername,
      userTasks,
      setUserTasks
    }
  },
  {
    persist: true
  }
)
